<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form action="#" onsubmit="return tijiao();">
儿童身高预测
<br/>
儿童性别： <input type="radio" name="gender" value="1" checked="true">男 <input type="radio" name="gender" value="0">女
<br/>
父亲的身高
<input type="text" name="fathershengao" value="170" id="fathershengao">厘米
母亲的身高
<input type="text" name="muqinshengao" value="165" id="muqinshengao">厘米
    <input type="submit" name="提交" value="提交"/>
</form>
<script type="text/javascript">
    function tijiao() {
        // 获取儿童身高
        let gender = document.querySelectorAll("input[name='gender']");
        // 输出性别
        let k = null;
        // 进行判断
        for (let genderElement of gender) {
            if(genderElement.checked){
                // 输出结果
                k = genderElement.value;
            }
        }
        // 获取身高
        let fathershengao = document.querySelector("#fathershengao");
        fathershengao = fathershengao.value;
        let muqinshengao = document.querySelector("#muqinshengao");
        muqinshengao = muqinshengao.value;
        // 进行输出
        console.log(fathershengao);
        console.log(muqinshengao);
        return false;
    }
</script>
</body>
</html>